﻿#include "ssBytesQue.h"

namespace StarSeeker
{

ssBytesQue::ssBytesQue()
	:m_totalSize(0)
{
}

ssBytesQue::~ssBytesQue()
{
}

void ssBytesQue::Push(ssBytesPtr& data, unsigned int len)
{
	m_queue.push_back(std::pair<ssBytesPtr, unsigned int>(data, len));
	m_totalSize += len;
}

void ssBytesQue::Pop()
{
	if (!m_queue.empty())
	{
		m_totalSize -= m_queue.front().second;
		m_queue.pop_front();
	}
}

void ssBytesQue::Clear()
{
	m_queue.clear();
	m_totalSize = 0;
}

//ssSessionQue::ssSessionQue()
//{
//	m_offset = 0;
//}
//
//ssSessionQue::~ssSessionQue()
//{
//}
//
//void ssSessionQue::Push(unsigned int id, ssBytesPtr& data, unsigned int len)
//{
//	m_lock.Lock();
//	m_mapQue[m_offset][id].Push(data, len);
//	m_lock.Unlock();
//}
//
//void ssSessionQue::SwitchOffset()
//{
//	m_lock.Lock();
//	m_offset = (m_offset + 1) % 2;
//	m_lock.Unlock();
//}
//
//std::map<unsigned int, StarSeeker::ssBytesQue>& ssSessionQue::CurrentMap()
//{
//	return m_mapQue[m_offset];
//}

}
